{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 视频语音转文字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "import requests\n",
    "import time"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "get baidu center info...\n",
      "24.74f02325069814269d810ec51d698072.2592000.1614051120.282335-19771629\n",
      "{'error_code': 6, 'error_msg': 'No permission to access data'}\n",
      "{'error_code': 6, 'error_msg': 'No permission to access data'}\n"
     ]
    }
   ],
   "source": [
    "\n",
    "\n",
    "APP_ID = '19771629' # APP_ID\n",
    "API_KEY = 'K5OiBazt8S6vSdpzE3tZ8ISH' # API_KEY\n",
    "SECRET_KEY = 'Wkqcx7yRG4GyOWrYcsfacpTdmGNgAu1G' # # SECRET_KEY\n",
    "\n",
    "def get_access_token(cltid, srt_key): # 获取访问令牌\n",
    "    # oauth_url = 'https://openapi.baidu.com/oauth/2.0/token'\n",
    "    oauth_url = 'https://aip.baidubce.com/oauth/2.0/token'\n",
    "    args_data = {'grant_type': 'client_credentials',\n",
    "                 'client_id': cltid,\n",
    "                 'client_secret': srt_key,\n",
    "                 }\n",
    "    cnt_type = {'Content-Type': 'application/json; charset=UTF-8'}\n",
    "    resp = requests.post(oauth_url, data=args_data, headers=cnt_type)\n",
    "    print(\"get baidu center info...\")\n",
    "    if resp.status_code != 200:\n",
    "        print(\"have http error\", resp.status_code)\n",
    "        return None\n",
    "    cnt = resp.json()  # 获取的内容变为字典\n",
    "    cnt['expires_in'] += int(time.time())  # 将有效期时间记录\n",
    "    with open('baidu.ck', 'w', encoding='utf-8') as fp:\n",
    "        res = {'access_token': cnt['access_token'], 'expires_in': cnt['expires_in']}\n",
    "        json.dump(res, fp)\n",
    "    return cnt['access_token']\n",
    "\n",
    "def upload_audio_file(access_token): # 上传你要识别的音频文件，得按照人家规定的参数和格式\n",
    "    # speed_url = 'http://vop.baidu.com/server_api'\n",
    "    speed_url = 'https://aip.baidubce.com/rpc/2.0/session/offline/upload/asr?access_token={%s}' % access_token\n",
    "    # args_data = {'format': 'pcm',\n",
    "    #              'rate': 8000,\n",
    "    #              'channel': 1,\n",
    "    #              'cuid': 'rocky_shop',  # 应用名称\n",
    "    #              'token': atoken,\n",
    "    #              }\n",
    "    args_data = {\n",
    "        \"appId\": APP_ID,\n",
    "        \"companyName\": \"百度\", # 这个可以修改\n",
    "        \"callId\": \"20e59200-57da-423e-b613-6a8ce126d0a7\", \n",
    "        \"agentFileUrl\": \"http://***\", # 语音文件的url，要公网可访问的地址\n",
    "        \"suffix\": \"wav\",\n",
    "    }\n",
    "    header = {'Content-Type': 'application/json'}\n",
    "    resp = requests.post(speed_url, data=json.dumps(args_data), headers=header)\n",
    "    info = resp.json()\n",
    "    return info\n",
    "\n",
    "def get_text_from_url(access_token): # 获取识别结果\n",
    "    datas = {\n",
    "        \"category\": \"OFFLINE_ASR_RESULT\",\n",
    "        \"paras\": {\n",
    "            \"appId\": APP_ID,  # 百度云appId,必选\n",
    "            \"callId\": \"20e59200-57da-423e-b613-6a8ce126d0a7\"  # 用户上传某一通的callId,必选\n",
    "        }\n",
    "    }\n",
    "    data_url = 'https://aip.baidubce.com/rpc/2.0/search/info?access_token={%s}' % access_token\n",
    "    header = {'Content-Type': 'application/json'}\n",
    "    response = requests.post(data_url, data=json.dumps(datas), headers=header)\n",
    "    information = response.json()\n",
    "    return information\n",
    "\n",
    "\n",
    "access_token = get_access_token(API_KEY, SECRET_KEY)\n",
    "print(access_token)\n",
    "info = upload_audio_file(access_token)\n",
    "print(info)\n",
    "result = get_text_from_url(access_token)\n",
    "print(result)\n",
    "\n",
    "# tmp = result['data']['content']\n",
    "# print(tmp)\n",
    "# tmp_list = eval(tmp)\n",
    "# for x in tmp_list:\n",
    "#     print(x['sentence'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "安装阿里云模块依赖包"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: aliyun-python-sdk-core in c:\\users\\86183\\anaconda3\\lib\\site-packages (2.13.30)\n",
      "Requirement already satisfied: cryptography<3.3,>=2.9.2 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core) (2.9.2)\n",
      "Requirement already satisfied: jmespath<1.0.0,>=0.9.3 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core) (0.10.0)\n",
      "Requirement already satisfied: six>=1.4.1 in c:\\users\\86183\\appdata\\roaming\\python\\python37\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core) (1.13.0)\n",
      "Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core) (1.14.0)\n",
      "Requirement already satisfied: pycparser in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cffi!=1.11.3,>=1.8->cryptography<3.3,>=2.9.2->aliyun-python-sdk-core) (2.20)\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install aliyun-python-sdk-core"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting aliyun-python-sdk-videorecog\n",
      "  Downloading aliyun-python-sdk-videorecog-1.0.1.tar.gz (2.9 kB)\n",
      "Requirement already satisfied: aliyun-python-sdk-core>=2.11.5 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-videorecog) (2.13.30)\n",
      "Requirement already satisfied: cryptography<3.3,>=2.9.2 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videorecog) (2.9.2)\n",
      "Requirement already satisfied: jmespath<1.0.0,>=0.9.3 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videorecog) (0.10.0)\n",
      "Requirement already satisfied: six>=1.4.1 in c:\\users\\86183\\appdata\\roaming\\python\\python37\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videorecog) (1.13.0)\n",
      "Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videorecog) (1.14.0)\n",
      "Requirement already satisfied: pycparser in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cffi!=1.11.3,>=1.8->cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videorecog) (2.20)\n",
      "Building wheels for collected packages: aliyun-python-sdk-videorecog\n",
      "  Building wheel for aliyun-python-sdk-videorecog (setup.py): started\n",
      "  Building wheel for aliyun-python-sdk-videorecog (setup.py): finished with status 'done'\n",
      "  Created wheel for aliyun-python-sdk-videorecog: filename=aliyun_python_sdk_videorecog-1.0.1-py3-none-any.whl size=5922 sha256=38bfac7e91d550a4e7747ff953158b4d474e148b6d2d5c5dab2352bc977883bb\n",
      "  Stored in directory: c:\\users\\86183\\appdata\\local\\pip\\cache\\wheels\\d6\\37\\64\\b8d4e2a98dea2f763b78a4786771b34291132c6e8318ee693e\n",
      "Successfully built aliyun-python-sdk-videorecog\n",
      "Installing collected packages: aliyun-python-sdk-videorecog\n",
      "Successfully installed aliyun-python-sdk-videorecog-1.0.1\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install aliyun-python-sdk-videorecog"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting aliyun-python-sdk-videoenhan\n",
      "  Downloading aliyun_python_sdk_videoenhan-1.0.7-py2.py3-none-any.whl (18 kB)\n",
      "Requirement already satisfied: aliyun-python-sdk-core>=2.11.5 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-videoenhan) (2.13.30)\n",
      "Requirement already satisfied: jmespath<1.0.0,>=0.9.3 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoenhan) (0.10.0)\n",
      "Requirement already satisfied: cryptography<3.3,>=2.9.2 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoenhan) (2.9.2)\n",
      "Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoenhan) (1.14.0)\n",
      "Requirement already satisfied: six>=1.4.1 in c:\\users\\86183\\appdata\\roaming\\python\\python37\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoenhan) (1.13.0)\n",
      "Requirement already satisfied: pycparser in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cffi!=1.11.3,>=1.8->cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoenhan) (2.20)\n",
      "Installing collected packages: aliyun-python-sdk-videoenhan\n",
      "Successfully installed aliyun-python-sdk-videoenhan-1.0.7\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install aliyun-python-sdk-videoenhan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting aliyun-python-sdk-videoseg\n",
      "  Downloading aliyun-python-sdk-videoseg-1.0.2.tar.gz (2.8 kB)\n",
      "Requirement already satisfied: aliyun-python-sdk-core>=2.11.5 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-videoseg) (2.13.30)\n",
      "Requirement already satisfied: jmespath<1.0.0,>=0.9.3 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoseg) (0.10.0)\n",
      "Requirement already satisfied: cryptography<3.3,>=2.9.2 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoseg) (2.9.2)\n",
      "Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoseg) (1.14.0)\n",
      "Requirement already satisfied: six>=1.4.1 in c:\\users\\86183\\appdata\\roaming\\python\\python37\\site-packages (from cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoseg) (1.13.0)\n",
      "Requirement already satisfied: pycparser in c:\\users\\86183\\anaconda3\\lib\\site-packages (from cffi!=1.11.3,>=1.8->cryptography<3.3,>=2.9.2->aliyun-python-sdk-core>=2.11.5->aliyun-python-sdk-videoseg) (2.20)\n",
      "Building wheels for collected packages: aliyun-python-sdk-videoseg\n",
      "  Building wheel for aliyun-python-sdk-videoseg (setup.py): started\n",
      "  Building wheel for aliyun-python-sdk-videoseg (setup.py): finished with status 'done'\n",
      "  Created wheel for aliyun-python-sdk-videoseg: filename=aliyun_python_sdk_videoseg-1.0.2-py3-none-any.whl size=5833 sha256=18bb1075768f1baf68fd63e0d8d01322e819c3ec099b218decc8ddaa848dcbce\n",
      "  Stored in directory: c:\\users\\86183\\appdata\\local\\pip\\cache\\wheels\\6e\\b2\\65\\8c4276decc62460385d3aa3c28e7992fd6be309b2f4c519dd0\n",
      "Successfully built aliyun-python-sdk-videoseg\n",
      "Installing collected packages: aliyun-python-sdk-videoseg\n",
      "Successfully installed aliyun-python-sdk-videoseg-1.0.2\n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "pip install aliyun-python-sdk-videoseg"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 视频画幅变换"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "ename": "ServerException",
     "evalue": "HTTP Status: 404 Error:InvalidAccessKeyId Specified access key is not found or invalid. RequestID: 38DA7BF0-110F-47D2-8625-FCBE69661D4A",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mServerException\u001b[0m                           Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-5-ad6908dd0971>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     16\u001b[0m \u001b[0mrequest\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mset_Tightness\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"0\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     17\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 18\u001b[1;33m \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdo_action_with_exception\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     19\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     20\u001b[0m \u001b[1;31m# python2:  print(response)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\Anaconda3\\lib\\site-packages\\aliyunsdkcore\\client.py\u001b[0m in \u001b[0;36mdo_action_with_exception\u001b[1;34m(self, acs_request)\u001b[0m\n\u001b[0;32m    474\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    475\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mexception\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 476\u001b[1;33m             \u001b[1;32mraise\u001b[0m \u001b[0mexception\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    477\u001b[0m         logger.debug('Response received. Product:%s Response-body: %s',\n\u001b[0;32m    478\u001b[0m                      acs_request.get_product(), body)\n",
      "\u001b[1;31mServerException\u001b[0m: HTTP Status: 404 Error:InvalidAccessKeyId Specified access key is not found or invalid. RequestID: 38DA7BF0-110F-47D2-8625-FCBE69661D4A"
     ]
    }
   ],
   "source": [
    "from aliyunsdkcore.client import AcsClient\n",
    "from aliyunsdkcore.acs_exception.exceptions import ClientException\n",
    "from aliyunsdkcore.acs_exception.exceptions import ServerException\n",
    "from aliyunsdkvideoenhan.request.v20200320.ChangeVideoSizeRequest import ChangeVideoSizeRequest\n",
    "\n",
    "client = AcsClient('<LTAI4GFNPHTTn9eeSPmt1QR8>', '<k3XPY2de0fylEodo9FLIpFIHwUENi6>', 'cn-shanghai')\n",
    "\n",
    "request = ChangeVideoSizeRequest()\n",
    "request.set_accept_format('json')\n",
    "\n",
    "request.set_VideoUrl(\"src=\\\"https://vd4.bdstatic.com/mda-khrk09z8tqhnp6vv/v1-cae/1080p/mda-khrk09z8tqhnp6vv.mp4?v_from_s=nj_haokanvideoui_5488&auth_key=1611460071-0-0-2fba21d450b730d238ff8f42161f216b&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=6_1\\\"\")\n",
    "request.set_Width(32)\n",
    "request.set_Height(32)\n",
    "request.set_CropType(\"samrt\")\n",
    "request.set_FillType(\"color\")\n",
    "request.set_Tightness(\"0\")\n",
    "\n",
    "response = client.do_action_with_exception(request)\n",
    "\n",
    "# python2:  print(response) \n",
    "print(str(response, encoding='utf-8'))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "code_folding": []
   },
   "outputs": [
    {
     "ename": "ServerException",
     "evalue": "HTTP Status: 404 Error:InvalidAccessKeyId Specified access key is not found or invalid. RequestID: C5839947-94A9-4D7D-801E-9692DA0BF2FA",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mServerException\u001b[0m                           Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-4-77805f6e9f7c>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     22\u001b[0m ])\n\u001b[0;32m     23\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 24\u001b[1;33m \u001b[0mresponse\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mclient\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdo_action_with_exception\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrequest\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     25\u001b[0m \u001b[1;31m# python2:  print(response)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     26\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mstr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresponse\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mencoding\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'utf-8'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32m~\\Anaconda3\\lib\\site-packages\\aliyunsdkcore\\client.py\u001b[0m in \u001b[0;36mdo_action_with_exception\u001b[1;34m(self, acs_request)\u001b[0m\n\u001b[0;32m    474\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    475\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mexception\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 476\u001b[1;33m             \u001b[1;32mraise\u001b[0m \u001b[0mexception\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    477\u001b[0m         logger.debug('Response received. Product:%s Response-body: %s',\n\u001b[0;32m    478\u001b[0m                      acs_request.get_product(), body)\n",
      "\u001b[1;31mServerException\u001b[0m: HTTP Status: 404 Error:InvalidAccessKeyId Specified access key is not found or invalid. RequestID: C5839947-94A9-4D7D-801E-9692DA0BF2FA"
     ]
    }
   ],
   "source": [
    "#!/usr/bin/env python\n",
    "#coding=utf-8\n",
    "\n",
    "from aliyunsdkcore.client import AcsClient\n",
    "from aliyunsdkcore.acs_exception.exceptions import ClientException\n",
    "from aliyunsdkcore.acs_exception.exceptions import ServerException\n",
    "from aliyunsdkvideoenhan.request.v20200320.EraseVideoLogoRequest import EraseVideoLogoRequest\n",
    "\n",
    "client = AcsClient('<LTAI4GFNPHTTn9eeSPmt1QR8>', '<k3XPY2de0fylEodo9FLIpFIHwUENi6>', 'cn-shanghai')\n",
    "\n",
    "request = EraseVideoLogoRequest()\n",
    "request.set_accept_format('json')\n",
    "\n",
    "request.set_VideoUrl(\"https://vd4.bdstatic.com/mda-khrk09z8tqhnp6vv/v1-cae/1080p/mda-khrk09z8tqhnp6vv.mp4?v_from_s=nj_haokanvideoui_5488&auth_key=1611460071-0-0-2fba21d450b730d238ff8f42161f216b&bcevod_channel=searchbox_feed&pd=1&pt=3&abtest=6_1\")\n",
    "request.set_Boxess([\n",
    "  {\n",
    "    \"H\": 0.5,\n",
    "    \"W\": 0.5,\n",
    "    \"X\": 0.5,\n",
    "    \"Y\": 0.5\n",
    "  }\n",
    "])\n",
    "\n",
    "response = client.do_action_with_exception(request)\n",
    "# python2:  print(response) \n",
    "print(str(response, encoding='utf-8'))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
